home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Graphics 2D / MacGamma / MacGamma.h < prev    next >
Encoding:
Text File  |  2000-09-28  |  3.9 KB  |  82 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        MacGamma.h
  3.  
  4.     Contains:    Functions to enable Mac OS device gamma adjustments using 3 channel 256 element 8 bit gamma ramps
  5.  
  6.     Written by:    Geoff Stahl (ggs)
  7.  
  8.     Copyright:    Copyright © 1999 Apple Computer, Inc., All Rights Reserved
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <7>     8/25/99    ggs     Added usage notes
  13.          <6>     8/25/99    ggs     Added usage notes
  14.          <5>     7/14/99    ggs     Added sample code notice
  15.          <4>     5/20/99    ggs     Updated function names.
  16.          <3>     5/20/99    ggs     Cleaned up and commented
  17.          <2>     5/20/99    ggs     Added system wide get and restore gamma functions to enable
  18.                                     restoration of original for all devices.  Modified functionality
  19.                                     to return pointers vice squirreling away the memory.
  20.          <1>     5/20/99    ggs     Initial Add
  21.  
  22.     Disclaimer:    You may incorporate this sample code into your applications without
  23.                 restriction, though the sample code has been provided "AS IS" and the
  24.                 responsibility for its operation is 100% yours.  However, what you are
  25.                 not permitted to do is to redistribute the source as "DSC Sample Code"
  26.                 after having made changes. If you're going to re-distribute the source,
  27.                 we require that you make it clear in the source that the code was
  28.                 descended from Apple Sample Code, but that you've made changes.
  29.  
  30. */
  31.  
  32.  
  33. // Usage notes: 
  34.  
  35. // SetDeviceGammaRampXX may not return until the VBL following their call, depending on the display driver,
  36. // this is due to the handling of the Control call by the driver.
  37.  
  38. // Startup and Shutdown:
  39.  
  40. // GetSystemGammas (...) must be called to save the system gammas prior to using MacGamma
  41. // RestoreSystemGamms (...)  must be called before exiting to restore original gamma
  42. // DisposeSystemGammas (...) can then be used to dispose of the system gammas
  43.  
  44. // Suspend and Resume:
  45.  
  46. // RestoreSystemGamms (...); DisposeSystemGammas (...); should also be called prior to suspend and
  47. // GetSystemGammas (...) should be called when resuming
  48. // this prevents users from saving display settings with your gammas
  49.  
  50.  
  51. // include control --------------------------------------------------
  52.  
  53. #ifndef MacGamma_h
  54. #define MacGamma_h
  55.  
  56.  
  57. // includes ---------------------------------------------------------
  58.  
  59. #include <Quickdraw.h>
  60. #include <QDOffscreen.h>
  61.  
  62.  
  63. // public function declarations -------------------------------------
  64.  
  65. // 5/20/99: (ggs) added system wide gamma get and restore
  66.  
  67. Ptr GetSystemGammas (void);                                        // returns a pointer to a set of all current device gammas in native format
  68.                                                                     // (returns NULL on failure, which means reseting gamma will not be possible)
  69. void RestoreSystemGammas (Ptr pSystemGammas);                    // restores all system devices to saved gamma setting
  70. void DisposeSystemGammas (Ptr* ppSystemGammas);                    // iterates through and deletes stored gamma settings
  71.  
  72.  
  73. Boolean GetDeviceGammaRampGD (GDHandle hGD, Ptr pRamp);            // retrieves the gamma ramp from a graphics device (pRamp: 3 arrays of 256 elements each)
  74. Boolean GetDeviceGammaRampGW (GWorldPtr pGW, Ptr pRamp);        // retrieves the gamma ramp from a graphics device associated with a GWorld pointer (pRamp: 3 arrays of 256 elements each)
  75. Boolean GetDeviceGammaRampCGP (CGrafPtr pGraf, Ptr pRamp);        // retrieves the gamma ramp from a graphics device associated with a CGraf pointer (pRamp: 3 arrays of 256 elements each)
  76.  
  77.  
  78. Boolean SetDeviceGammaRampGD (GDHandle hGD, Ptr pRamp);            // sets the gamma ramp for a graphics device (pRamp: 3 arrays of 256 elements each (R,G,B))
  79. Boolean SetDeviceGammaRampGW (GWorldPtr pGW, Ptr pRamp);        // sets the gamma ramp for a graphics device associated with a GWorld pointer (pRamp: 3 arrays of 256 elements each (R,G,B))
  80. Boolean SetDeviceGammaRampCGP (CGrafPtr pGraf, Ptr pRamp);        // sets the gamma ramp for a graphics device associated with a CGraf pointer (pRamp: 3 arrays of 256 elements each (R,G,B))
  81.  
  82. #endif // MacGamma_h